package homework;

import java.io.BufferedWriter;
import java.io.FileWriter;
import java.lang.management.BufferPoolMXBean;
import java.util.HashMap;
import java.util.Iterator;

/**
 * @author Administrator
 */
public class Task {
    public static void main(String[] args) throws  Exception{
        HashMap<Integer,String> hashMap=new HashMap<Integer,String>();
        hashMap.put(1,"tqh");
        hashMap.put(2,"汤千han");

        BufferedWriter bufferedWriter=new BufferedWriter(new FileWriter("D:\\a.txt"));
        Iterator iterator=(Iterator) hashMap.keySet().iterator();
        while (iterator.hasNext()){
            Integer key= (Integer) iterator.next();
            String value=hashMap.get(key);
            bufferedWriter.write(key+"--"+value);
            bufferedWriter.newLine();
            bufferedWriter.flush();
        }
    }
}
